<template>
    <view>
        <view class="cu-list menu sm-border" v-if="device">
            <view class="cu-item">
                <view class="content" hover-class="none" url="./device-info/device-info">
                    <text class="text-grey">设备名称</text>
                </view>
                <view class="action">
                    <text class="text-black text-sm">{{device.deviceName}}</text>
                </view>
            </view>
            <view class="cu-item">
                <view class="content" hover-class="none" url="./device-info/device-info">
                    <text class="text-grey">省份</text>
                </view>
                <view class="action">
                    <text class="text-black text-sm">{{device.provinceName}}</text>
                </view>
            </view>
            <view class="cu-item">
                <view class="content" hover-class="none" url="./device-info/device-info">
                    <text class="text-grey">城市</text>
                </view>
                <view class="action">
                    <text class="text-black text-sm">{{device.cityName}}</text>
                </view>
            </view>
            <view class="cu-item">
                <view class="content" hover-class="none" url="./device-info/device-info">
                    <text class="text-grey">商家</text>
                </view>
                <view class="action">
                    <text class="text-black text-sm">{{device.storeName}}</text>
                </view>
            </view>
            <view class="cu-item">
                <view class="content" hover-class="none" url="./device-info/device-info">
                    <text class="text-grey">零售价</text>
                </view>
                <view class="action">
                    <text class="text-black text-sm">{{device.price}}</text>
                </view>
            </view>
            <view class="cu-item">
                <view class="content" hover-class="none" url="./device-info/device-info">
                    <text class="text-grey">库存</text>
                </view>
                <view class="action">
                    <text class="text-black text-sm">{{device.stock}}</text>
                </view>
            </view>
<!--            <view class="cu-item">-->
<!--                <view class="content" hover-class="none" url="./device-info/device-info">-->
<!--                    <text class="text-grey">分成信息</text>-->
<!--                </view>-->
<!--            </view>-->
        </view>

    </view>
</template>

<script lang="ts">
    import Vue from 'vue';
    import {http} from "@/utils/utils";

    export default Vue.extend({
        data() {
            return {
                deviceId: '', device: null
            }
        },
        onLoad(opt: any) {
            this.deviceId = opt.deviceId;
            console.log(this.deviceId);
            uni.showLoading();
            http.get("api/devices/" + this.deviceId).then((res: any) => {
                this.device = res.data;
                console.log(this.device);
            }).finally(() => uni.hideLoading())
        },
    })
</script>

<style>

</style>
